package com.ibeeking.found.open.b.rest.controller.v1;


import com.ibeeking.found.common.enums.OpenApiConfigEnum;
import com.ibeeking.found.common.enums.WxOpenAppTypeEnum;
import com.ibeeking.found.common.utils.UserUtils;
import com.ibeeking.found.open.b.rest.service.*;
import com.ibeeking.found.open.service.common.param.QueryOpenAuthInfoParam;
import com.ibeeking.found.open.service.common.vo.OpenAuthVO;
import com.ibeeking.found.open.service.common.vo.OpenAuthViewVO;
import com.ibeeking.found.open.service.common.vo.WxOpenAuthFuncVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.exception.BusinessException;
import com.ibeeking.nematos.log.annotation.Log;
import com.ibeeking.nematos.utils.data.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/v1/open/api/aliAuth")
public class AliAuthController {

    @Resource
    private IAliPayOpenEventService aliPayOpenEventServiceImpl;

    @Resource
    private IAliDingTalkOpenEventService aliDingTalkOpenEventServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询或更新支付宝第三方授权")
    @PostMapping(value = "/queryOrUpdateAliPayOpenAuthInfo")
    public OpenAuthVO queryOrUpdateAliPayOpenAuthInfo(@RequestBody @Validated QueryOpenAuthInfoParam param) throws Exception {
        return aliPayOpenEventServiceImpl.queryOrUpdateOpenAuthInfo(param);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询或更新钉钉第三方授权")
    @PostMapping(value = "/queryOrUpdateAliDingTalkOpenAuthInfo")
    public OpenAuthVO queryOrUpdateAliDingTalkOpenAuthInfo(@RequestBody @Validated QueryOpenAuthInfoParam param) throws Exception {
        return aliPayOpenEventServiceImpl.queryOrUpdateOpenAuthInfo(param);
    }
}